﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils.Entity;
using Utils.DC.Web.UI;
using System.IO;

public partial class Admin_Module_he_thong_quan_tri_noi_dung : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        UserEntity user = PageUtility.IsLogin(Session);
        if (user != null)
        {
            WelcomePanel.Visible = true;
            LoginPanel.Visible = false;
            VisitorCounter();
        }
        else
        {
            WelcomePanel.Visible = false;
            LoginPanel.Visible = true;
        }
        
    }

    private void VisitorCounter()
    {
        double _visitor = 0;
        try
        {

            TextReader tr = new StreamReader(Server.MapPath("~/Upload/visitor.txt"));
            _visitor = Convert.ToDouble(tr.ReadLine());
            tr.Close();
            tr.Dispose();
        }
        catch (Exception e) { }
        _lblNumberVisitor.Text = _visitor.ToString("N0");
        _lblNumberOnline.Text = Application["visitors_online"].ToString();
    }
}
